//
//  SearchView.m
//  HJZWeiBo
//
//  Created by lanou on 16/5/28.
//  Copyright © 2016年 蒋晨成. All rights reserved.
//

#import "SearchView.h"

@implementation SearchView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/


- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.textField = [[UITextField alloc]initWithFrame:CGRectMake(0, 0, kWidth - 10 - 30, 30)];
        self.textField.placeholder = @"大家都在搜：胡歌";
        self.textField.backgroundColor = PKCOLOR(220, 220, 220);
        self.textField.layer.cornerRadius = 5;
        UIImageView *left = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"search"]];
        left.frame = CGRectMake(0, 0, 20, 20);
        self.textField.leftView = left;
        self.textField.leftViewMode = UITextFieldViewModeAlways;
        self.voiceButton = [UIButton buttonWithType:UIButtonTypeCustom];
        self.voiceButton.frame = CGRectMake(self.textField.frame.size.width, 0, 30, 25);
        [self.voiceButton setImage:[UIImage imageNamed:@"voice"] forState:UIControlStateNormal];
        [self addSubview:_textField];
        [self addSubview:_voiceButton];
    }
    return self;
}

@end
